import type { postOrPutType } from "@/constants";
import type { HasId, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.js";
/* 红包商城 运费模板 地址*/
const url = "/back/mall-deliver";
/* 获取 运费模板信息 */
export const getMallDeliverInfo = <T, D>(params?: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url, params);
};
/* 获取 运费模板详情信息 */
export const getMallDeliverByIdInfo = <T, D extends HasId>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/" + params.id, params);
};
/* 新增，修改运费模板信息 */
export const commonMallDeliverInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 删除 运费模板信息 */
export const deleteMallDeliverInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};
